package com.lyrcsoft.springmvc.init.handler.adapter;

import com.lyrcsoft.springmvc.controller.Controller;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author fujc-dev@qq.com
 * @version 1.0
 */
@Component
public class BeanNameHandlerAdapter implements HandlerAdapter {
    @Override
    public boolean supports(Object handler) {
        return handler instanceof Controller;
    }

    @Override
    public Object handler(HttpServletRequest request, HttpServletResponse response, Object handler) {
        return ((Controller) handler).handler(request, response);
    }
}
